#include<iostream>
#include<vector>
#include<unordered_map>

using namespace std;

int main(){
	int n, k;
	cin>>n;
	vector<int> nums(n);
	for(int i=0;i<n;i++){
		cin>>nums[i];
	}
	cin>>k;

	if (n < 2) {
        cout<<"false";
        return 0;
    }
    unordered_map<int, int> mp;
    mp[0] = -1;
    int remainder = 0;
    for (int i = 0; i < n; i++) {
        remainder = (remainder + nums[i]) % k;
        if (mp.count(remainder)) {
            int prevIndex = mp[remainder];
            if (i - prevIndex >= 2) {
                cout<<"true";
                return 0;
            }
        } else {
            mp[remainder] = i;
        }
    }
    cout<<"false";
	
	return 0;
} 
